import request from '@/utils/request'

const api_name = '/admin/follow'

// 分页查询关注记录
export const GetFollowPageList = (page, limit) => {
  return request({
    url: `${api_name}/${page}/${limit}`,
    method: 'get',
  })
}

// 添加关注
export const SaveFollow = follow => {
  return request({
    url: `${api_name}/save`,
    method: 'post',
    data: follow,
  })
}

// 取消关注
export const RemoveFollow = id => {
  return request({
    url: `${api_name}/remove/${id}`,
    method: 'delete',
  })
}

// 查询关注状态
export const CheckFollowStatus = (followerId, followedId) => {
  return request({
    url: `${api_name}/checkFollowStatus/${followerId}/${followedId}`,
    method: 'get',
  })
}

// 获取用户的关注列表
export const GetFollowingList = (userId, page = 1, limit = 10) => {
  return request({
    url: `${api_name}/findFollowingList/${userId}`,
    method: 'get',
    params: { page, limit },
  })
}

// 获取用户的粉丝列表
export const GetFollowerList = (userId, page = 1, limit = 10) => {
  return request({
    url: `${api_name}/findFollowerList/${userId}`,
    method: 'get',
    params: { page, limit },
  })
}
